﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace JuSolution.Web.ApiService
{
    /// <summary>
    /// RsaService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class RsaService : System.Web.Services.WebService
    {
        private JuCloudy.Data.Nhibernate.RsaContainer container { get; set; }

        [WebMethod]
        public string Decrypt(String RsaId, String Content)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            return container.Decrypt(RsaId, Content);
        }
        [WebMethod]
        public string DecryptByRsaId(String RsaId)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            return container.DecryptByRsaId(RsaId);
        }
        [WebMethod]
        public void Encrypt(String RsaId, string PublicKey, string Content, string IpAddress)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            container.Encrypt(RsaId, PublicKey, Content, IpAddress);
        }
        [WebMethod]
        public String GeneralKey(string IpAddress, out string PublicKey)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            return container.GeneralKey(IpAddress, out PublicKey);
        }
        [WebMethod]
        public String GetRsaContent(String RsaId)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            return container.GetRsaContent(RsaId);
        }
        [WebMethod]
        public string GetRsaKey(String RsaId, bool OnlyPub)
        {
            container = new JuCloudy.Data.Nhibernate.RsaContainer();
            return container.GetRsaKey(RsaId, OnlyPub);
        }
    }
}
